//////////////////
/// mkI - Base ///
//////////////////

#pragma once

// Base includes
#include "../../Base/mkBaseDeclare.h"

#ifdef MK_PLATFORM_WIN
#   define mkErrno( err, format, ... )                              \
    if( err != mk::Errno_Success )                                  \
    {                                                               \
        mk::ErrnoMessage( err, __FUNCTION__, format, __VA_ARGS__ ); \
    }
#else
#   define mkErrno( err, format, ... )
#endif

#define mkErrnoFailure( err ) (mk::Errno)(err) != mk::Errno::Errno_Success

namespace mk
{

// Errno enum error codes
enum Errno
{
    Errno_Success = 0,
    Errno_InvalidData,
    Errno_InvalidParameter,
    Errno_NotFound,
    Errno_InputOutput,
    Errno_EndOfFile,
    Errno_FileExists,
    Errno_NoMemory,
    Errno_Unknown,
    Errno_Count
};

// Get the error as a string.
char const* GetErrnoString( Errno err );

// Errno message.
Errno ErrnoMessage( Errno err, char const* function, char const* format, ... ) MK_NOEXCEPT;

} // namespace mk

